//   Copyright 2010 Shantanu Shah<shantanus@gmail.com>
//
//   Licensed under the Apache License, Version 2.0 (the "License");
//   you may not use this file except in compliance with the License.
//   You may obtain a copy of the License at
//
//       http://www.apache.org/licenses/LICENSE-2.0
//
//   Unless required by applicable law or agreed to in writing, software
//   distributed under the License is distributed on an "AS IS" BASIS,
//   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//   See the License for the specific language governing permissions and
//   limitations under the License.

package com.shansense.coretimer;

import android.app.Activity;
import android.content.ComponentName;
import android.content.Intent;
import android.widget.Button;
import android.widget.TimePicker;

/**
 * Change mode plugin. Every mode you wish to time must implement this plugin.
 * This plugin allows us to use the same framework for different modes.
 * 
 * @see SilenceModeTimer 
 * @author Shantanu Shah <shantanus@gmail.com>
 */
public interface ChangeModePlugin {
  
  /**
   * @return Intent used to fire the activity from notification
   */
  public Intent getNotificationIntent();

  /**
   * @return Intent used to start the service.
   */
  public Intent getServiceIntent();
  
  /**
   * Return broadcast receiver component names. These will be disabled to avoid re-triggering
   * when mode is changed.
   * @return ComponentName of receiver or null
   */
  public ComponentName getReceiverComponentName();

  /* Mode related. */
  
  /**
   * Enter the mode, e.g. airplanemode
   */
  public void enterMode();
  
  /**
   * Leave the mode, e.g. airplanemode
   */
  public void leaveModeAndClearNotifications();
  
  /**
   * @return true if phone is already in desired mode
   */
  public boolean isModeSet();
  
  /* UI Elements, strings, etc. */
  
  /**
   * @return int - Notification icon to use in notification bar.
   */
  public int getNotificationIcon();
  
  /**
   * @return String - Notification text, e.g. "In silence mode till"
   */
  public String getNotificationString();
  
  /**
   * @return AppLayout from res
   */
  public int getAppLayout();

  /**
   * Clear notifications, if any.
   */
  public void clearNotifications();
  
  /**
   * @return Button to cancel previous timer
   */
  public Button getButtonUnset();
  
  /**
   * @return Button OK
   */
  public Button getButtonOK();
  
  /**
   * @return Button Cancel
   */
  public Button getButtonCancel();
  
  /**
   * @return Button Share, or null
   */
  public Button getButtonShare();

  /**
   * @return Button for creating shortcut
   */
  public Button getButtonShortcut(); 
  
  /**
   * @return resource id of icon of this app
   */
  public int getApplicationIcon();

  /**
   * @return Text to use when sharing using sms/twitter/email etc
   */
  public String getShareText();

  /**
   * @return Button which links to market
   */
  public Button getButtonMarket();

  /**
   * @param savedTimePrefString one of AbsChangeModeTimer.PREF_SAVED_TIME
   * @return Button corresponding to the string
   */
  public Button getSavedButton(String savedTimePrefString);

  /**
   * Hide the quick select text and buttons.
   */
  public void hideQuickSelect();

  /**
   * @return String app name, which must be same as class name of Main Activity,
   * e.g. SilenceModeTimer
   */
  public String getAppName();

  /**
   * @return String name to be used in shortcut, generally same as getAppName, but could be
   * different.
   */
  public String getShortcutName();
  
  /**
   * @return Button for help
   */
  public Button getButtonHelp();

  /**
   * @return TimePicker which shows and allows selecting time.
   */
  public TimePicker getTimePicker();

  /**
   * @return Activity associated with this plugin.
   */
  public Activity getActivity();
  
  /**
   * @return int tab index if applicable, else a negative number.
   */
  public int getTabIndexIfPresent();
}
